package com.redside.webapp.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * This class provides application-wide access to the Spring ApplicationContext.
 *
 * @author <a href="mailto:pchapman@easystreet.net">Peter Chapman</a>
 */
public class AppContext {

    /**
     * Get access to the Spring ApplicationContext from anywhere in the ApplicationProperties.
     *
     * @return
     */
    public static ApplicationContext getApplicationContext() {
        return new ClassPathXmlApplicationContext(new String[]{
    			"classpath:/applicationContext-resources.xml",
                "classpath:/applicationContext-dao.xml",
                "classpath:/spring-dao-sql.xml", // for JDBCDaoSupport
                "classpath*:/applicationContext.xml", // for modular projects
                "classpath:**/applicationContext*.xml" // for web projects
                });
    }
}

